package day2;

import java.io.File;

//递归删除
public class TextDelete {
    public static void main(String[] args) {
        File f = new File("D://wuxi.D//File");
        deleteFile(f);
    }

    public static void deleteFile(File file) {
        //fs = null 是文件     fs长度为0 空目录
        File[] fs = file.listFiles();
        if (fs != null && fs.length > 0) {
            for (File f : fs) {
                deleteFile(f);
            }
        }
        boolean b = file.delete();
        if (b) {
            System.out.println("删除成功:" + file.getAbsolutePath());
        }
    }
}
